<?php
class ModelNewsInstall extends Model {
	public function install() {
		$this->db->query("CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "news(
			news_id int NOT NULL AUTO_INCREMENT,
			PRIMARY KEY(news_id),
			news_category_id int,
			sort_order int,
			created_date datetime,
			updated_date datetime,
			status int
		)");
		
		$this->db->query("CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "news_category(
				news_category_id int NOT NULL AUTO_INCREMENT,
				PRIMARY KEY(news_category_id),
				sort_order int,
				created_date datetime,
				updated_date datetime,
				status int
		)");
		
		$this->db->query("CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "news_category_description(
				news_category_id int, 
				language_id int, 
				PRIMARY KEY(news_category_id, language_id),
				news_name varchar(255),
				description text,
				meta_keyword varchar(255),
				meta_description varchar(255)	
				
		)");
		
		$this->db->query("CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "news_description(
				news_id int, 
				language_id int, 
				PRIMARY KEY(news_id, language_id),
				title varchar(255),
				description text,
				meta_keyword varchar(255),
				meta_description varchar(255),	
				author varchar(255),
				image varchar(255)
		)");
		
		print "Database is installed";
	}	
}
?>